# Contributor: David Huffman <storedbox@outlook.com>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=glog
pkgver=0.6.0
pkgrel=1
pkgdesc="C++ implementation of the Google logging module"
url="https://github.com/google/glog"
arch="all"
license="BSD-3-Clause"
depends_dev="gflags-dev"
makedepends="$depends_dev cmake gtest-dev libucontext-dev libunwind-dev samurai"
subpackages="$pkgname-dev"
source="https://github.com/google/glog/archive/v$pkgver/glog-$pkgver.tar.gz
	ucontext-ppc64le.patch"
options="!check" # 2 test fails https://github.com/google/glog/issues/813

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DWITH_GFLAGS=ON \
		-DWITH_THREADS=ON \
		-DWITH_TLS=ON \
		-DPRINT_UNSYMBOLIZED_STACK_TRACES=OFF
	cmake --build build
}

check() {
	cd build
	# Test is failing: https://github.com/google/glog/issues/813
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E symbolize
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
fd2c42583d0dd72c790a8cf888f328a64447c5fb9d99b2e2a3833d70c102cb0eb9ae874632c2732424cc86216c8a076a3e24b23a793eaddb5da8a1dc52ba9226  glog-0.6.0.tar.gz
f23ddb3c60566f11510f6f0ad768893df44d7b22659dc0dbe476dc40c0dbd64ecd825b6b05fda0376b35cacda931b016e04c84c892e662ead3200f04e30fd08b  ucontext-ppc64le.patch
"
